package com.niiwoo.activity.stage.enums.prize;


import com.niiwoo.activity.stage.enums.goods.GoodsTypeDicEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author zhaoqiang
 * @ClassName: UserPrizeTypeIdEnum
 * @Description: 红包类型枚举
 * @date 2017/11/23
 * var typs = {'0':'提现红包','1':'担保代金券','2':'担保投资代金券','3':'投资代金券','4':'现金红包','5':'担保理财金','7':'投资理财金','8':'投资加息券','9':'投资返现红包','10':'担保返现红包','11':'借款返现红包'};
 */
@Getter
@AllArgsConstructor
public enum UserPrizeTypeIdEnum {

    // 红包类型：0 提现红包、 4现金红包、5担保理财金、7投资理财金、8投资加息券、 9投资返现红包、10担保返现红包、11借款返现红包 12借款利率折扣卡
    WITHDRAW_VOUCHER((byte) 0, "提现红包", "withdrawPrizeServiceImpl", (byte) -1),
    //GUARANTEE_VOUCHER((byte) 1, "担保代金券","",(byte),""),
    //GUARANTEE_INVESTMENT_VOUCHER((byte) 2, "担保投资代金券","",(byte),""),
    //INVESTMENT_VOUCHER((byte) 3, "投资代金券","",(byte),""),
    CASH_REDPACKET((byte) 4, "现金红包", "cashPrizeServiceImpl", (byte) 2),
    GUARANTEE_EXPERIENCE((byte) 5, "担保理财金", "", (byte) 0),
    //    GUARANTEE_INVESTMENT_EXPERIENCE((byte) 6, "担保投资体验券","",(byte),"",""),
    INVESTMENT_EXPERIENCE((byte) 7, "投资理财金", "", (byte) 2),
    INVESTMENT_RAISE_INTEREST_RATES((byte) 8, "投资加息券", "investmentRaiseServiceImpl", (byte) 2),
    INVESTMENT_CASHBACK((byte) 9, "投资返现红包", "investmentCashbackServiceImpl", (byte) 2),
    GUARANTEE_CASHBACK((byte) 10, "担保返现红包", "guaranteeCashbackServiceImpl", (byte) 0),
    LOAN_CASHBACK((byte) 11, "借款返现红包", "loanCashbackServiceImpl", (byte) 3),
    BORROW_INTEREST_RATE_DISCOUNT((byte) 12, "借款利率折扣卡", "borrowInterestRateServiceImpl", (byte) 3),
    INTEREST((byte) 13, "投资加息", "", (byte) 3);

    private Byte prizeType;
    private String description;
    private String prizeProcessName;
    private Byte accountRole;


    public static UserPrizeTypeIdEnum getPrizeTypeId(Byte prizeTypeId) {
        for (UserPrizeTypeIdEnum typeId : values()) {
            if (typeId.getPrizeType().equals(prizeTypeId)) {
                return typeId;
            }
        }
        return null;
    }

    public static UserPrizeTypeIdEnum getEnumByGoodsTypeId(Integer goodsTypeId) {
        if (GoodsTypeDicEnum.TIXIAN_HB.getId().equals(goodsTypeId)) return WITHDRAW_VOUCHER;
        if (GoodsTypeDicEnum.XIANJIN_HB.getId().equals(goodsTypeId)) return CASH_REDPACKET;
        if (GoodsTypeDicEnum.TOUZI_JXQ.getId().equals(goodsTypeId)) return INVESTMENT_RAISE_INTEREST_RATES;
        if (GoodsTypeDicEnum.DANBAO_FXQ.getId().equals(goodsTypeId)) return GUARANTEE_CASHBACK;
        if (GoodsTypeDicEnum.TOUZI_FXQ.getId().equals(goodsTypeId)) return INVESTMENT_CASHBACK;
        if (GoodsTypeDicEnum.JIEKUAN_FXQ.getId().equals(goodsTypeId)) return LOAN_CASHBACK;
        if (GoodsTypeDicEnum.JIEKUAN_LILV_ZKK.getId().equals(goodsTypeId)) return BORROW_INTEREST_RATE_DISCOUNT;
        return null;
    }
}
